   
   <link href="{{$LAYOUT_HELPER_URL}}admin/js/jquery-ui/css/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="{{$LAYOUT_HELPER_URL}}admin/js/jquery-ui/js/jquery-ui.js"></script>
<script src="{{$LAYOUT_HELPER_URL}}admin/js/jquery.slug.js"></script>



    
<script type="text/javascript">
    //<![CDATA[
function submitForm1(id)
{
    
    jQuery('#postIn'+id).val(id);
    jQuery('#in'+id).submit();
}
function submitForm2(id)
{
    jQuery('#postOut'+id).val(id);
    jQuery('#sale'+id).submit();
}

jQuery(document).ready(function (){
    //Datepicker
    jQuery( ".date" ).datepicker({
        showAnim        : 'slideDown',
        showButtonPanel : true,
        dateFormat      : '{{$datepickerFormat.js}}'
          
    });
    
});

function input(id)
{
    jQuery('#input' + id).show();
    jQuery('#more').hide();
            
}
function output(id)
{
    jQuery('#output' + id).show();
    jQuery('#more').hide();
}

</script>
            
            
             <!-- End .shortcut-buttons-set -->
            
            <div class="clear"></div> <!-- End .clear -->
           
            
            
            <div class="content-box"><!-- Start Content Box -->
                
                <div class="content-box-header">
                    
                    <div style="float:left;">
                    <h3>Thống kê sản phẩm</h3>
                   </div>     
                   <div style="float:right;padding-right:20px;padding-top:5px;">
                        
                   </div>
                    
                </div> <!-- End .content-box-header -->
                
                <div class="content-box-content">
                    
                    <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
                        
                        
                        {{if $selectMessage|@count > 0 && $selectMessage.success == true}}
                        <div class="notification success png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                {{$selectMessage.message}}
                            </div>
                        </div>
                        {{/if}}
                        
                        {{if $selectMessage|@count > 0 && $selectMessage.success == false}}
                        <div class="notification error png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                {{$selectMessage.message}}
                            </div>
                        </div>
                        {{/if}}
                        
                        <!-- END MESSAGE -->
                        
                        
                        
                                <p>
                                    <label>Tên sản phẩm</label>
                                    &nbsp;{{$product.title}}
<!--                                    {{$product.title}}-->
                                </p><div style="clear: both;"/> </div>
                               <p>
                                    <label>Nhà sản xuất</label>
                                    &nbsp;{{$product.provider}}
                                </p> <div style="clear: both;"/> </div>
                                <p>
                                    <label>Tồn kho</label>
                                    <b>{{$product.store}}</b> {{$product.unit_name}}
                                </p><div style="clear: both;"/> </div>
                                </br>
                        
                        {{if $allInputs|@count > 0}}
                        <h3 style="color: blue;">Thông tin nhập hàng</h3>
                        </br>
                        {{if $group==1}}
                        <table>
                            <thead>
                                <tr>
                                   
                                   <th width="20%">Ngày nhập</th>
                                   <th width="20%">Giá nhập</th>
                                   <th width="20%">Số lượng</th>
                                   <th width="30%">Ghi chú</th>
                                    <th width="10%">Sửa/Xóa</th>
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            {{foreach from=$allInputs item=item name=product}}
                                <tr>
                                    <td>{{$item.created_date}}</td>
                                    <td>{{$item.input_price|@number_format:0:'.':' '}}</td>
                                    <td>{{$item.soluong|@number_format:0:'.':' '}}</td>
                                    <td>{{$item.ghichu}}</td>
                                    <td>
                                         {{if $fullPermisison}}
                                         <a href="javascript:input({{$item.input_id}});" title="Edit input"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/pencil.png"  alt="Edit Product" /></a>
                                         <a href="javascript:deleteAInput({{$item.input_id}})" title="Delete"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross.png"  alt="Delete" /></a>
                                         {{else}}
                                         --
                                         {{/if}}
                                   </td>
                                    
                                    
                                    <!-- END 1 COL -->
                                    
                                </tr>
                                
                                <form id="in{{$item.input_id}}" method="post" action="{{$APP_BASE_URL}}product/admin/edit-input/id/{{$item.input_id}}">
                                           <tr id="input{{$item.input_id}}" style="display: none;">
                                            <td colspan="8">
                                                 <input type="text" class="date" name="input[{{$item.input_id}}][created_date]" value="{{$item.created_date}}" style="float: left; width: 150px;margin-right: 10px;" />
                                                <input type="text" name="input[{{$item.input_id}}][input_price]" value="{{$item.input_price}}" style="float: left; width: 150px;margin-right: 10px;"/>
                                               <input type="text" name="input[{{$item.input_id}}][soluong]" value="{{$item.soluong}}" style="float: left; width: 150px;margin-right: 10px;"/>
                                               <input type="text" name="input[{{$item.input_id}}][ghichu]" value="{{$item.ghichu}}" style="float: left; width: 150px;margin-right: 10px;"/>
                                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                            <input id="postIn{{$item.input_id}}" class="hidden" type="text" name="input[num]" value ="0">
                                            <br><button class="button" onclick="submitForm1({{$item.input_id}});">Luu</button>
                                            </td>
                                
                                           </tr>
                               </form>
                            {{/foreach}}    
                                
                            
                           </tbody>
                        </table>
                         {{else}}
                             <table>
                            <thead>
                                <tr>
                                   
                                   <th width="20%">Ngày nhập</th>
                                   <th width="20%">Số lượng</th>
                                   <th width="30%">Ghi chú</th>
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            {{foreach from=$allInputs item=item name=product}}
                                <tr>
                                    <td>{{$item.created_date}}</td>
<!--                                    <td>{{$item.input_price|@number_format:0:'.':' '}}</td>-->
                                    <td>{{$item.soluong|@number_format:0:'.':' '}}</td>
                                    <td>{{$item.ghichu}}</td>                                   
                                    
                                    <!-- END 1 COL -->
                                    
                                </tr>
                                
                               
                            {{/foreach}}    
                                
                            
                           </tbody>
                        </table>
                          {{/if}}
                        {{/if}}
                        </br>
                        </br>
                        <br>
                        <br>
                        {{if $allSales|@count > 0}}
                        <h3 style="color: blue;">Thông tin bán hàng</h3>
                        </br>
                        {{if $group==1}}
                        <table>
                            <thead>
                                <tr>
                                   
                                   <th width="20%">Ngày bán</th>
                                   <th width="20%">Giá bán</th>
                                   <th width="20%">Số lượng</th>
                                   <th width="30%">Ghi chú</th>
                                    <th width="10%">Sửa/Xóa</th>
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            {{foreach from=$allSales item=item name=product}}
                                <tr>
                                    
                                    <td>{{$item.created_date}}</td>
                                    <td>{{$item.sale_price|@number_format:0:'.':' '}}</td>
                                    <td>{{$item.soluong|@number_format:0:'.':' '}}</td>
                                    <td>{{$item.ghichu}}</td>
                                    <td width="10%">
                                         {{if $fullPermisison}}
                                         <a href="javascript:output({{$item.sale_id}});" title="Edit input"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/pencil.png"  alt="Edit Product" /></a>
                                         <a href="javascript:deleteASale({{$item.sale_id}})" title="Delete"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross.png"  alt="Delete" /></a>
                                         {{else}}
                                         --
                                         {{/if}}
                                    </td>
                                    
                                    <!-- END 1 COL -->
                                    
                                </tr>
                                
                                <form id="sale{{$item.sale_id}}" method="post" action="{{$APP_BASE_URL}}product/admin/edit-sale/id/{{$item.sale_id}}">
                                           <tr id="output{{$item.sale_id}}" style="display: none;">
                                            <td colspan="8">
                                                 <input type="text" class="date" name="sale[{{$item.sale_id}}][created_date]" value="{{$item.created_date}}" style="float: left; width: 150px;margin-right: 10px;" />
                                                <input type="text" name="sale[{{$item.sale_id}}][sale_price]" value="{{$item.sale_price}}" style="float: left; width: 150px;margin-right: 10px;"/>
                                               <input type="text" name="sale[{{$item.sale_id}}][soluong]" value="{{$item.soluong}}" style="float: left; width: 150px;margin-right: 10px;"/>
                                               <input type="text" name="sale[{{$item.sale_id}}][ghichu]" value="{{$item.ghichu}}" style="float: left; width: 150px;margin-right: 10px;"/>
                                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                            <input id="postOut{{$item.sale_id}}" class="hidden" type="text" name="sale[num]" value ="0">
                                            <br><button class="button" onclick="submitForm2({{$item.sale_id}});">Luu</button>
                                            </td>
                                
                                           </tr>
                               </form>
                                 
                                           
                            {{/foreach}}    
 
                            </tbody>
                        </table>
                        {{else}}
                            <table>
                            <thead>
                                <tr>
                                   
                                   <th width="20%">Ngày bán</th>
                                   <th width="20%">Số lượng</th>
                                   <th width="30%">Ghi chú</th>
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            {{foreach from=$allSales item=item name=product}}
                                <tr>
                                    
                                    <td>{{$item.created_date}}</td>
                                    <td>{{$item.soluong|@number_format:0:'.':' '}}</td>
                                    <td>{{$item.ghichu}}</td>
                                    
                                    <!-- END 1 COL -->
                                    
                                </tr>
                                 
                                           
                            {{/foreach}}    
 
                            </tbody>
                        </table>
                        {{/if}}
                       {{/if}}
                        
                        <br/>
                     
                        
                        
                        <div class="clear"></div>
                    </div> <!-- End #tab1 -->
                    
                     <A class="button" HREF="javascript:window.print()">In Nội Dung</A>
                </div> <!-- End .content-box-content -->
                
            </div> <!-- End .content-box -->
           
            
            <div class="clear"></div>
            
<script language="javascript" type="text/javascript">





function deleteAInput(id)
{
    result = confirm('Are you sure you want to delete this input?');
    if (false == result) {
        return;
    }
    window.location.href = '{{$APP_BASE_URL}}product/admin/delete-input/id/' + id;
}

function deleteASale(id)
{
    result = confirm('Are you sure you want to delete this sale?');
    if (false == result) {
        return;
    }
    window.location.href = '{{$APP_BASE_URL}}product/admin/delete-sale/id/' + id;
}
</script>
